<style type="text/css">
    .pagination p{
        margin:0;
        cursor:pointer
    }
    .pagination{
        height:40px;
        padding:20px 0px;
    }
    .pagination a{
        display:block;
        float:left;
        margin-right:10px;
        padding:2px 12px;
        height:24px;
        border:1px #cccccc solid;
        background:#fff;
        text-decoration:none;
        color:#808080;
        font-size:12px;
        line-height:24px;
    }
    .pagination a:hover{
        color:#009688;
        background: white;
        border:1px #009688 solid;
    }
    .pagination a.cur{
        border:none;
        background:#009688;
        color:#fff;
    }
    .pagination p{
        float:left;
        padding:2px 12px;
        font-size:12px;
        height:24px;
        line-height:24px;
        color:#bbb;
        border:1px #ccc solid;
        background:#fcfcfc;
        margin-right:8px;

    }
    .pagination p.pageRemark{
        border-style:none;
        background:none;
        margin-right:0px;
        padding:4px 0px;
        color:#666;
    }
    .pagination p.pageRemark b{
        color:red;
    }
    .pagination p.pageEllipsis{
        border-style:none;
        background:none;
        padding:4px 0px;
        color:#808080;
    }
    .dates li {font-size: 14px;margin:20px 0}
    .dates li span{float:right}
</style>
<div class="pagination">
    <?php if(isset($model) && isset($model['page'])){
        $page = isset($model['page'])&&!(empty($model['page']))?$model['page']:1;
        $offset = isset($model['offset'])&&!(empty($model['offset']))?$model['offset']:15;
        $last_page = isset($model['last_page'])&&!(empty($model['last_page']))?$model['last_page']:1;
        $total = isset($model['total'])&&!(empty($model['total']))?$model['total']:0;
        $url = parse_url($_SERVER['REQUEST_URI']);
        $url = $url['path'];
        if($last_page > 1){
            if($page==1){
                echo "<p>首页</p><a href='javascript:void(0)' class='cur'>1</a>";
            }else{
                echo "<a href='".$url."' title='首页' >首页</a>";
                echo "<a href='".$url."'?page=1' title='1' >1</a>";
            }
            $ignore = false;
            for($i=2;$i<=$last_page;$i++){
                if($page!=$i){
                    if(abs($page-$i)<5){
                        echo "<a href='".$url."?page=".$i."' title='".$i."' >".$i."</a>";
                    }else{
                        if(abs($page-$i)==5){
                            echo "<a>...</a>";
                        }
                    }
                }else{
                    echo "<a href='javascript:void(0)' class='cur'>$i</a>";
                }
            }

            if($page>=$last_page ){
                echo "<p>尾页</p>";
            }else{
                echo "<a href='".$url."?page=".$last_page."' title='尾页' >尾页</a>";
            }

            echo "<p class='pageRemark'>共".$last_page."页<b></b>页<b>".$total."</b>条数据</p>";
        }
    }?>
</div>